package com.employ.admin.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
//import org.springframework.security.core.GrantedAuthority;
//import org.springframework.security.core.userdetails.UserDetails;

import java.util.List;

//@TableName("User")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)//链式构造器
@ApiModel("统一响应对象")
public class User{//} implements UserDetails {

    @TableId(value = "id",type = IdType.AUTO)
    private Integer id = 0;
    private String username;
    private String password;
    private String nickname;
    private String email;

    private Integer age;
    private String sex;
    private String address;
    private Integer role;//角色 1 管理员 2 普通用户
    private String token;
    private String avatar;
    private String city;

    //    private List<GrantedAuthority> authorities;
    public String getUsername() {
        return username;
    }
//    @Override
//    public boolean isAccountNonExpired() {
//        return true;
//    }
//    @Override
//    public boolean isAccountNonLocked() {
//        return true;
//    }
//    @Override
//    public boolean isCredentialsNonExpired() {
//        return true;
//    }
//    @Override
//    public boolean isEnabled() {
//        return true;
//    }

//    public User(){
//
//    }

    public User(String username,String password,String nickname,String email,Integer role,boolean state){

        this.username = username;
        this.password = password;
        this.nickname = nickname;
        this.email = email;
        this.role = role;

    }

    @Override
    public String toString(){
        return "User{" +
                "id=" + id +
                ",username=" + username + '\'' +
                ",password=" + password + '\'' +
                ",nickname=" + nickname + '\'' +
                ",email=" + email + '\'' +
                ",role=" + role +
                '}';
    }
}
